	// Support: IE<10
	// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`


function getWindow( elem ) {
	return jQuery.isWindow( elem ) ?
		elem :
		elem.nodeType === 9 ?
			elem.defaultView || elem.parentWindow :
			false;
}

jQuery.fn.size = function() {
	return this.length;
};

function genFx( type, includeWidth ) {
	var which,
		attrs = { height: type },
		i = 0;

	// if we include width, step value is 1 to do all cssExpand values,
	// if we don't include width, step value is 2 to skip over Left and Right
	includeWidth = includeWidth? 1 : 0;
	for( ; i < 4 ; i += 2 - includeWidth ) {
		which = cssExpand[ i ];
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
	}

	if ( includeWidth ) {
		attrs.opacity = attrs.width = type;
	}

	return attrs;
}

$(document).ready(function () {
	$('#div_workinghour').hide();
	$('#div_workinghour_blank').hide();
	$('#div_reserve').hide();
	$('#div_booking').hide();
	
	
	$('#div_calendar .canbook').click(function(){
		if ($('#div_workinghour').is(':hidden')){
		    $('#div_workinghour_blank').show();
		    
		    //------show blank timetable
		    
		} else {
		    $('#div_workinghour').hide(); 
		}
	});	
	
	$('#div_calendar .reserved').click(function(){
		if ($('#div_workinghour').is(':hidden')){
			
			//-------Ajax timetable
			
		    $('#div_workinghour').show();
		} else {
		    $('#div_workinghour').hide(); 
		    $('#div_reserve').hide();
			$('#div_booking').hide();
		}
	});	
	
	//---------------------------------------------------
	
	$('#div_workinghour_blank .td_blank').click(function(e){
		var getID = $(this).attr('id');
		alert(getID.length());
	});
		
	//---------------------------------------------------
	
	$('#div_workinghour .reserved').click(function(){
		if ($('#div_reserve').is(':hidden')){
			$('#div_booking').hide();		    
		    
		    //-------Ajax reserve data
		    
			$('#div_reserve').show();
		} else {
		    $('#div_reserve').hide(); 
		}
	});
	
	$('#div_workinghour .canbook').click(function(){
		if ($('#div_booking').is(':hidden')){
			$('#div_reserve').hide();
			
			//--------Ajax Detail
			
		    $('#div_booking').show();
		    
		    //--------show div input table
		    
		} else {
		    $('#div_booking').hide(); 
		}
	});
	
	$('#btn_return').click(function(){
		var url = "/bookingSearch.jsp";    
		$(location).attr('href',url);
	});
});